﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using CanDoo.Core.Data;
using CanDoo.Data;
using CanDoo.Admin.Core.Models;

namespace CanDoo.Oil.Core.Models
{
    /// <summary>
    /// 实体类——库存
    /// </summary>
    [Serializable]
    [Description("库存")]
    public class Stock :  EntityBase,ICreatedTime, IAudited
    {
        /// <summary>
        ///仓库
        /// </summary>
        [Display(Name = "仓库")]
        public virtual Warehouse Warehouse { get; set; }
        /// <summary>
        ///仓库外键
        /// </summary>
        [Display(Name = "仓库外键")]
        public long WarehouseId { get; set; }

        /// <summary>
        ///产品
        /// </summary>
        [Display(Name = "产品")]
        public virtual Product Product { get; set; }
        /// <summary>
        ///产品外键
        /// </summary>
        [Display(Name = "产品外键")]
        public long ProductId { get; set; }

        /// <summary>
        ///最高采购价
        /// </summary>
        [Display(Name = "最高采购价")]
        [Required]
        public double HighPrice { get; set; }

        /// <summary>
        ///最低采购价
        /// </summary>
        [Display(Name = "最低采购价")]
        [Required]
        public double LowPrice { get; set; }

        /// <summary>
        ///最近采购价
        /// </summary>
        [Display(Name = "最近采购价")]
        [Required]
        public double NowPrice { get; set; }

        /// <summary>
        ///成本价
        /// </summary>
        [Display(Name = "成本价")]
        [Required]
        public double CostPrice { get; set; }

        /// <summary>
        ///库存数量
        /// </summary>
        [Display(Name = "库存数量")]
        [Required]
        public double StockNum { get; set; }

        /// <summary>
        ///在途数量
        /// </summary>
        [Display(Name = "在途数量")]
        [Required]
        public double OnWayNum { get; set; }

        /// <summary>
        ///等待退货数量
        /// </summary>
        [Display(Name = "等待退货数量")]
        [Required]
        public double WaitBackNum { get; set; }

        /// <summary>
        ///合理库存数量
        /// </summary>
        [Display(Name = "合理库存数量")]
        [Required]
        public double ReasonableNum { get; set; }

        /// <summary>
        ///库存下线
        /// </summary>
        [Display(Name = "库存下线")]
        [Required]
        public double TopNum { get; set; }

        /// <summary>
        ///库存上线
        /// </summary>
        [Display(Name = "库存上线")]
        [Required]
        public double BottomNum { get; set; }

        /// <summary>
        ///启用报警
        /// </summary>
        [Display(Name = "启用报警")]
        [Required]
        public bool EnableAlerm { get; set; }

        /// <summary>
        ///备注
        /// </summary>
        [Display(Name = "备注")]
        [StringLength(500)]
        public string Remark { get; set; }

        
        #region Implementation of ICreatedTime

        /// <summary>
        /// 获取设置 信息创建时间
        /// </summary>
        [Display(Name = "创建时间")]
        public DateTime CreatedTime { get; set; }
        #endregion

        #region Implementation of ICreatedAudited

        /// <summary>
        /// 获取或设置 创建者编号
        /// </summary>
        [Display(Name = "创建人")]
        public string CreatorUserId { get; set; }

        #endregion

        #region Implementation of IUpdateAutited

        /// <summary>
        /// 获取或设置 最后更新时间
        /// </summary>
        [Display(Name = "最后更新时间")]
        public DateTime? LastUpdatedTime { get; set; }

        /// <summary>
        /// 获取或设置 最后更新者编号
        /// </summary>
        [Display(Name = "最后更新用户")]
        public string LastUpdatorUserId { get; set; }

        #endregion
    }
}
